package com.pb.infra.taskManage.service;

import com.pb.infra.taskManage.mapper.OperationMonitoringMapper;
import com.pb.infra.oth.entity.common.Page;
import com.pb.infra.oth.entity.common.Result;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 *运行监测
 * @author liaohaoyuan
 * @date 20210501
 */
@Service
public class OperationMonitoringService {

    /**
     * DAO映射
     */
    @Resource
    private OperationMonitoringMapper operationMonitoringMapper;

    /**
     * 监测数据
     * @param map
     * @param page
     * @return
     */
    public Result getTabledate(Map<String, Object> map, Page page) {
        Integer pageIndex = Integer.parseInt(map.get("pageIndex").toString());
        Integer pageSize = Integer.parseInt(map.get("pageSize").toString());
        Integer pageEnd = pageSize * pageIndex;
        Integer pageStart = (pageIndex - 1) * pageSize;
        map.put("pageEnd", pageEnd);
        map.put("pageStart", pageStart);
        List<Map<String, Object>> list = operationMonitoringMapper.getTabledate(map);
        return Result.ok(operationMonitoringMapper.selectCount(map), list);
    }

}
